package test.db.table.oracle;

import org.junit.Ignore;
import org.junit.Test;

import test.db.util.DBUtil;

/**
 * @author newbie
 * @since 0.1
 */
public class OracleInitDb {

    private String query_pw_bbs = null;
    private String query_pw_bbs_history = null;
    private String query_pw_bbs_type = null;
    private String query_pw_category = null;
    private String query_pw_bbs_file = null;
    private String query_pw_bbs_memo = null;
    private String query_pw_user = null;
    private String query_pw_user_trace = null;
    private String query_pw_authority = null;
    private String query_pw_attach_file = null;
    private String query_pw_primary_code = null;
    private String query_pw_secondary_code = null;
    private String query_pw_login_history = null;

    public OracleInitDb() {
        query_pw_bbs = OracleTableList.PW_BBS.getQuery();
        query_pw_bbs_history = OracleTableList.PW_BBS_HISTORY.getQuery();
        query_pw_bbs_type = OracleTableList.PW_BBS_TYPE.getQuery();
        query_pw_category = OracleTableList.PW_BBS_CATEGORY.getQuery();
        query_pw_bbs_file = OracleTableList.PW_BBS_FILE.getQuery();
        query_pw_bbs_memo = OracleTableList.PW_BBS_MEMO.getQuery();
        query_pw_user = OracleTableList.PW_USER.getQuery();
        query_pw_user_trace = OracleTableList.PW_USER_TRACE.getQuery();
        query_pw_authority = OracleTableList.PW_AUTHORITY.getQuery();
        query_pw_attach_file = OracleTableList.PW_ATTACH_FILE.getQuery();
        query_pw_primary_code = OracleTableList.PW_PRIMARY_CODE.getQuery();
        query_pw_secondary_code = OracleTableList.PW_SECONDARY_CODE.getQuery();
        query_pw_login_history = OracleTableList.PW_LOGIN_HISTORY.getQuery();
    }

    @Test
    public void initTable() throws Exception {
        DBUtil.createTable(query_pw_bbs, OracleTableList.PW_BBS.getTableName(), DBUtil.TYPE.ORACLE);
        DBUtil.createTable(query_pw_bbs_history, OracleTableList.PW_BBS_HISTORY.getTableName(), DBUtil.TYPE.ORACLE);
        DBUtil.createTable(query_pw_bbs_type, OracleTableList.PW_BBS_TYPE.getTableName(), DBUtil.TYPE.ORACLE);
        DBUtil.createTable(query_pw_category, OracleTableList.PW_BBS_CATEGORY.getTableName(), DBUtil.TYPE.ORACLE);
        DBUtil.createTable(query_pw_bbs_file, OracleTableList.PW_BBS_FILE.getTableName(), DBUtil.TYPE.ORACLE);
        DBUtil.createTable(query_pw_bbs_memo, OracleTableList.PW_BBS_MEMO.getTableName(), DBUtil.TYPE.ORACLE);
        DBUtil.createTable(query_pw_user, OracleTableList.PW_USER.getTableName(), DBUtil.TYPE.ORACLE);
        DBUtil.createTable(query_pw_user_trace, OracleTableList.PW_USER_TRACE.getTableName(), DBUtil.TYPE.ORACLE);
        DBUtil.createTable(query_pw_authority, OracleTableList.PW_AUTHORITY.getTableName(), DBUtil.TYPE.ORACLE);
        DBUtil.createTable(query_pw_attach_file, OracleTableList.PW_ATTACH_FILE.getTableName(), DBUtil.TYPE.ORACLE);
        DBUtil.createTable(query_pw_primary_code, OracleTableList.PW_PRIMARY_CODE.getTableName(), DBUtil.TYPE.ORACLE);
        DBUtil.createTable(query_pw_secondary_code, OracleTableList.PW_SECONDARY_CODE.getTableName(), DBUtil.TYPE.ORACLE);
        DBUtil.createTable(query_pw_login_history, OracleTableList.PW_LOGIN_HISTORY.getTableName(), DBUtil.TYPE.ORACLE);
    }

    // @Ignore
    @Test
    public void initData() throws Exception {
        OracleTableList.PW_BBS.initData();
		// OracleTableList.PW_BBS_HISTORY.initData();
		// OracleTableList.PW_BBS_TYPE.initData();
		// OracleTableList.PW_BBS_CATEGORY.initData();
        // OracleTableList.PW_BBS_FILE.initData();
        // OracleTableList.PW_BBS_MEMO.initData();
        // OracleTableList.PW_USER.initData();
        // OracleTableList.PW_USER_TRACE.initData();
        // OracleTableList.PW_AUTHORITY.initData();
		// OracleTableList.PW_ATTACH_FILE.initData();
		// OracleTableList.PW_PRIMARY_CODE.initData();
		// OracleTableList.PW_SECONDARY_CODE.initData();
		// OracleTableList.PW_LOGIN_HISTORY.initData();
    }

    @Ignore
    @Test
    public void dropTable() throws Exception {
        DBUtil.dropTable(OracleTableList.PW_AUTHORITY.getTableName(), DBUtil.TYPE.ORACLE);
        DBUtil.dropTable(OracleTableList.PW_BBS_HISTORY.getTableName(), DBUtil.TYPE.ORACLE);
        DBUtil.dropTable(OracleTableList.PW_BBS.getTableName(), DBUtil.TYPE.ORACLE);
        DBUtil.dropTable(OracleTableList.PW_BBS_TYPE.getTableName(), DBUtil.TYPE.ORACLE);
        DBUtil.dropTable(OracleTableList.PW_BBS_CATEGORY.getTableName(), DBUtil.TYPE.ORACLE);
        DBUtil.dropTable(OracleTableList.PW_BBS_FILE.getTableName(), DBUtil.TYPE.ORACLE);
        DBUtil.dropTable(OracleTableList.PW_BBS_MEMO.getTableName(), DBUtil.TYPE.ORACLE);
        DBUtil.dropTable(OracleTableList.PW_USER.getTableName(), DBUtil.TYPE.ORACLE);
        DBUtil.dropTable(OracleTableList.PW_USER_TRACE.getTableName(), DBUtil.TYPE.ORACLE);
        DBUtil.dropTable(OracleTableList.PW_ATTACH_FILE.getTableName(), DBUtil.TYPE.ORACLE);
        DBUtil.dropTable(OracleTableList.PW_SECONDARY_CODE.getTableName(), DBUtil.TYPE.ORACLE);
        DBUtil.dropTable(OracleTableList.PW_PRIMARY_CODE.getTableName(), DBUtil.TYPE.ORACLE);
        DBUtil.dropTable(OracleTableList.PW_LOGIN_HISTORY.getTableName(), DBUtil.TYPE.ORACLE);
    }
}